﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FBGraph.ClientGenerator.CodeGen;

namespace FBGraph.ClientGenerator.Tests.CodeGen
{
    [TestClass]
    public class ChainedConstructorTests
    {
        [TestMethod]
        public void WritesBaseChainParameterless()
        {
            var chain = new ChainedConstructor("base");

            var expected = ": base()";
            var actual = chain.ToString();

            Assert.AreEqual(expected.Trim(), actual.Trim());
        }

        [TestMethod]
        public void WritesThisChainParameterless()
        {
            var chain = new ChainedConstructor("this");

            var expected = ": this()";
            var actual = chain.ToString();

            Assert.AreEqual(expected.Trim(), actual.Trim());
        }

        [TestMethod]
        public void WritesBaseChainOneParameter()
        {
            var chain = new ChainedConstructor("base", "foo");

            var expected = ": base(foo)";
            var actual = chain.ToString();

            Assert.AreEqual(expected.Trim(), actual.Trim());
        }

        [TestMethod]
        public void WritesThisChainOneParameter()
        {
            var chain = new ChainedConstructor("base", "foo");

            var expected = ": base(foo)";
            var actual = chain.ToString();

            Assert.AreEqual(expected.Trim(), actual.Trim());
        }

        [TestMethod]
        public void WritesBaseChainTwoParameters()
        {
            var chain = new ChainedConstructor("base", "foo", "bar");

            var expected = ": base(foo, bar)";
            var actual = chain.ToString();

            Assert.AreEqual(expected.Trim(), actual.Trim());
        }

        [TestMethod]
        public void WritesThisChainTwoParameter()
        {
            var chain = new ChainedConstructor("base", "foo", "bar");

            var expected = ": base(foo, bar)";
            var actual = chain.ToString();

            Assert.AreEqual(expected.Trim(), actual.Trim());
        }
    }
}